package com.mz.mattress.admin.api.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mz.mattress.admin.api.req.OrderQueryReq;
import com.mz.mattress.admin.service.OrderService;
import com.mz.mattress.api.common.Constants;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping(Constants.ADMIN_PATH + "order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/listPage")
    public Result<IPage<Order>> listPage(OrderQueryReq req) {
        return orderService.listPage(req);
    }

    @GetMapping(value = "/{id}")
    public Result<Order> detail(@PathVariable Integer id) {
        return orderService.getById(id);
    }

}
